package JLB_Chapter_09;

public class code_09_03 {
    public static void main(String[] args) {
        Double dNum = Double.valueOf("3.14");
        Double dNum1 = Double.valueOf("3.1");
        Double dNum2 = Double.valueOf("3.2");
        Double dNum3 = Double .valueOf("3.14");
        // 判断是否为非数字值
        System.out.println("3.14是否为非数字值：" + Double.isNaN(dNum.doubleValue()));
        // 转换为int类型
        System.out.println("3.14转换为int值：" + dNum.intValue());
        // 判断大小
        System.out.println("值为3.14的Double对象与3.14的比较结果：" + dNum.equals(3.14));
        System.out.println("值为3.14的Double对象与3.1的比较结果：" + dNum.compareTo(dNum1));
        System.out.println("值为3.14的Double对象与3.2的比较结果：" + dNum.compareTo(dNum2));
        System.out.println("值为3.14的Double对象与3.14的比较结果：" + dNum.compareTo(dNum3));
        System.out.println("3.14的十六进制表示为：" + Double.toHexString(dNum));
        //String str = dNum.toString();
        String str = Double.toString(dNum);
        System.out.println(str);
    }
}
